<style>
#stat_report h1.report{
	padding-left:24px;
}
#stat_report fieldset{
	float:left;
}
#stat_report_result{
	margin-top:2px;
}
#stat_report_result table tr td{
	vertical-align:top;
}
#stat_report ul.letter_filter{
	margin:5px 0px;
}
#stat_report ul.letter_filter strong{
	width:auto;
}
#stat_report .block{
	float:left;
	padding:0px 5px;
}
</style>
<div id="stat_report">
	<form method="post" action="javascript:void(0)" onSubmit="submitForm(this,'ugovori.php','POST','setContent',1)" class="area">
		<h1 class="report">Statistika ugovora</h1>
	
		<input type="hidden" name="a" value="real_report" />
		<input type="hidden" name="mod" value="stat" />
		
		<fieldset>
			<legend>Datum ugovora:</legend>
			
			<label for="filter_date_start" class="left">od:</label>
			<input type="text" name="filter_date_start" id="filter_date_start" class="dateInput" value="{{$filter_date_start}}" />
			<input type="button" class="datePicker" onClick="displayDatePicker('filter_date_start',this)" />
			<br clear="all" />
			<label for="filter_date_end" class="left">do:</label>
			<input type="text" name="filter_date_end" id="filter_date_end" class="dateInput" value="{{$filter_date_end}}" />
			<input type="button" class="datePicker" onClick="displayDatePicker('filter_date_end',this)" />
			
		</fieldset>
		
		<fieldset>
			<legend>Dopis</legend>
			
			<label for="filter_dopis_type" class="left">Tip dopisa:</label>
			<select name="filter_dopis_type" id="filter_dopis_type">
				<option value="-1">---</option>
				{{%loop start dopis_type_id}}
				<option value="{{$dopis_type_id}}" {{$dopis_type_selected}}>{{$dopis_type_name}}</option>
				{{%loop end}}
			</select>
			<br clear="all" />
			<label for="filter_dopis_result" class="left">Ishod dopisa:</label>
			<select name="filter_dopis_result" id="filter_dopis_result">
				<option value="-1">---</option>
				{{%loop start dopis_result_id}}
				<option value="{{$dopis_result_id}}" {{$dopis_result_selected}}>{{$dopis_result_name}}</option>
				{{%loop end}}
			</select>
			
		</fieldset>
		
		<div class="block">
			<label class="left" for="filter_no_obnova">Ne želi obnovu:</label>
			<select name="filter_ne_obnova" id="filter_ne_obnova">
				<option value="0">---</option>
				<option value="1" {{$selected_ne_obnova_da}}>DA</option>
				<option value="2" {{$selected_ne_obnova_ne}}>NE</option>
			</select>
			
			<label class="left" for="filter_storno">Izbaci storno:</label>
			<input type="checkbox" class="checkbox" name="filter_storno" id="filter_storno" {{$checked_storno}}/>

			<br clear="all" />
			<label class="left" for="filter_tip_ugovora">Tip ugovora:</label>
			<select name="filter_tip_ugovora" id="filter_tip_ugovora">
				<option value="-1">---</option>
				{{%loop start tip_ugovora_id}}
				<option value="{{$tip_ugovora_id}}" {{$tip_ugovora_selected}}>{{$tip_ugovora_name}}</option>
				{{%loop end}}
			</select>
			
			<br clear="all" />
			<label class="left" for="filter_kampanja">Kampanja:</label>
			<select name="filter_kampanja" id="filter_kampanja">
				<option value="-1">---</option>
				{{%loop start kampanja_id}}
				<option value="{{$kampanja_id}}" {{$kampanja_selected}}>{{$kampanja_name}}</option>
				{{%loop end}}
			</select>
			
			<br clear="all" />
			<label class="left" for="filter_radnik">Komercijalista:</label>
			<select name="filter_radnik" id="filter_radnik">
				<option value="-1">---</option>
				{{%loop start radnik_id}}
				<option value="{{$radnik_id}}" {{$radnik_selected}}>{{$radnik_ime}}&nbsp;{{$radnik_prezime}}</option>
				{{%loop end}}
			</select>
		</div>
		
		<input type="submit" value="filter" />
	</form>
	<br clear="all" />
	<div class="area" id="stat_report_result">
		{{$comment_start}}
		<div class="info">Ugovora:&nbsp;{{$ukupno}}, Komitenata:&nbsp;{{$ukupno_komitenata}}</div>
		<ul class="letter_filter" filterquery="{{$filter_query}}">
			<li><strong style="width:auto;">Strana:</strong></li>
			{{%loop start page}}
			<li><a href="javascript:void(0)" onclick="PageFilter(this,'ugovori.php',{{$page}})" {{$current_page}}>{{$page}}</a></li>
			{{%loop end}}
		</ul><br clear="all" />
		<table>
			<tr class="head" align="center">
				<td>broj</td>
				<td>datum</td>
				<td>kampanja</td>
				<td>komercijalista</td>
				<td>dopis</td>
				<td>ne obnova</td>
				<td>komitent</td>
				<td>stavke</td>
				<td>napomena</td>
				<td>vrednost</td>
				<td>uplate</td>
				<td>dug</td>
			</tr>
			{{%loop start broj}}
			<tr>
				<td>{{$broj}}</td>
				<td>{{$datum}}</td>
				<td>{{$kampanja}}</td>
				<td>{{$komercijalista}}</td>
				<td>{{$dopis}}</td>
				<td align="center">{{$ne_obnova}}</td>
				<td>{{$komitent}}</td>
				<td>{{$stavke}}</td>
				<td>{{$napomena}}</td>
				<td align="right">{{$vrednost}}</td>
				<td align="right">{{$uplate}}</td>
				<td align="right">{{$dug}}</td>
			</tr>
			{{%loop end}}
		</table>
		{{$comment_end}}
	</div>
</div>